package com.ssau.expert.common;

/**
 * Author: Sergey42
 * Date: 26.11.13 11:17
 */
public class Answer {

    protected String value1;

    protected int cf1;

    protected String value2;

    protected int cf2;

    protected boolean fuzzy;

    public Answer() {
    }

    public Answer(String value1, int cf1) {
        this.value1 = value1;
        this.cf1 = cf1;
        fuzzy = false;
    }

    public Answer(String value1, int cf1, String value2, int cf2) {
        this.value1 = value1;
        this.cf1 = cf1;
        this.value2 = value2;
        this.cf2 = cf2;
        fuzzy = true;
    }

    public String getValue1() {
        return value1;
    }

    public void setValue1(String value1) {
        this.value1 = value1;
    }

    public int getCf1() {
        return cf1;
    }

    public void setCf1(int cf1) {
        this.cf1 = cf1;
    }

    public String getValue2() {
        return value2;
    }

    public void setValue2(String value2) {
        this.value2 = value2;
    }

    public int getCf2() {
        return cf2;
    }

    public void setCf2(int cf2) {
        this.cf2 = cf2;
    }

    public boolean isFuzzy() {
        return fuzzy;
    }

    public void setFuzzy(boolean fuzzy) {
        this.fuzzy = fuzzy;
    }

    @Override
    public String toString() {
        return "Answer{" +
                "value1='" + value1 + '\'' +
                ", cf1=" + cf1 +
                ", value2='" + value2 + '\'' +
                ", cf2=" + cf2 +
                '}';
    }

    public String format() {
        return String.format("Значение 1: %s\nCF1: %s\nЗначение 2: %s\nCF2: %s",
                value1,
                cf1,
                value2 != null && !"".equals(value2) ? value2 : "-",
                cf2 != 0 ? cf2 : "-");
    }
}
